<?php 

include('connect.php');

if(isset($_POST['save'])){
	
	$tables = null;
	$primaryKeys = null;
	
	if(isset($_REQUEST['EDIT_FEE_CODE'])){
		$tables = array('FEES');
		$primaryKeys = array($_REQUEST['EDIT_FEE_CODE']);
	}
	if(isset($_REQUEST['EDIT_TRNID'])){
		$tables = array('TRANSACTIONS');
		$primaryKeys = array($_REQUEST['EDIT_TRNID']);
	}
	
	updateQuery($tables, $primaryKeys);
}

//else{

	$table = null;

	if(isset($_REQUEST['EDIT_FEE_CODE'])){
		$temp = $_REQUEST['EDIT_FEE_CODE'];
		$table = mysql_query("SELECT * FROM FEES WHERE FEE_CODE='$temp'");
		echo("<form action='?page=transaction_edit' method='post'>");
		echo("<input type='hidden' name='EDIT_FEE_CODE' value='$temp'/>");
	}
	if(isset($_REQUEST['EDIT_TRNID'])){
		$temp = $_REQUEST['EDIT_TRNID'];
		$table = mysql_query("SELECT * FROM TRANSACTIONS WHERE TRNID='$temp'");
		echo("<form action='?page=transaction_edit' method='post'>");
		echo("<input type='hidden' name='EDIT_TRNID' value='$temp'/>");

	}
		
	$swaps = array(	'TRNID'		=>	'SKIP',
					'DEFAULT'	=>	'<input type="text" name="KEYMARKER" value="VALUEMARKER" />');
	
	printTable($table, $swaps);
	
	echo('<input type="hidden" name="save" value="yes"/>');
	echo('<br/><input type="submit" value="Save"/>');
	echo('</form>');

//}
include('disconnect.php');

?>